/**
 * 掘金微热榜样式表
 * 提供精美的UI界面样式
 */

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f4f5f7;
    color: #333;
    padding: 20px;
    line-height: 1.5;
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #1e80ff, #007fff);
    color: white;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.header h1 .hot-tag {
    background-color: rgba(255, 255, 255, 0.2);
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 10px;
}

/* 刷新按钮 */
.refresh-button {
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.refresh-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.refresh-button .icon {
    width: 20px;
    height: 20px;
}

.refresh-button.rotating .icon {
    animation: rotate 1s linear;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 分类标签 */
.tabs {
    display: flex;
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 0 20px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.tab {
    padding: 15px 20px;
    cursor: pointer;
    font-size: 15px;
    color: #666;
    position: relative;
    transition: color 0.3s;
    white-space: nowrap;
}

.tab.active {
    color: #1e80ff;
    font-weight: 500;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 2px;
    background-color: #1e80ff;
}

.tab:hover {
    color: #1e80ff;
}

/* 内容区域 */
.content {
    padding: 20px;
}

/* 文章列表 */
.article-list {
    list-style: none;
}

.article-item {
    padding: 20px;
    border-bottom: 1px solid #f4f4f4;
    display: flex;
    position: relative;
    transition: all 0.3s;
}

.article-item:hover {
    background-color: #f9fafc;
}

.article-item:last-child {
    border-bottom: none;
}

/* 文章排名 */
.article-rank {
    font-size: 18px;
    font-weight: bold;
    color: #b2bac2;
    margin-right: 20px;
    min-width: 30px;
    text-align: center;
}

.article-rank.top1 {
    color: #e9546b;
}

.article-rank.top2 {
    color: #f6ad55;
}

.article-rank.top3 {
    color: #4fc08d;
}

/* 文章内容 */
.article-content {
    flex: 1;
}

.article-title {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.5;
}

.article-title a {
    color: inherit;
    text-decoration: none;
}

.article-title a:hover {
    color: #1e80ff;
}

.article-desc {
    font-size: 14px;
    color: #86909c;
    margin-bottom: 10px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 文章元数据 */
.article-meta {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #8a919f;
    flex-wrap: wrap;
}

.article-meta-item {
    display: flex;
    align-items: center;
    margin-right: 16px;
    margin-bottom: 4px;
}

.article-meta-item i {
    margin-right: 4px;
    font-size: 16px;
}

.article-meta-item.hot {
    color: #ff6b6b;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #8a919f;
}

.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(30, 128, 255, 0.2);
    border-radius: 50%;
    border-top-color: #1e80ff;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 错误状态 */
.error {
    text-align: center;
    padding: 40px;
    color: #e9546b;
}

/* 图标样式 */
.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
    margin-right: 4px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 15px 20px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .tab {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .article-item {
        padding: 15px;
    }
    
    .article-title {
        font-size: 15px;
    }
    
    .article-desc {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    
    .article-meta {
        font-size: 12px;
    }
    
    .article-meta-item {
        margin-right: 12px;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }
    
    .container {
        background-color: #1e1e1e;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    .tabs {
        background-color: #1e1e1e;
        border-bottom-color: #333;
    }
    
    .tab {
        color: #aaa;
    }
    
    .article-item {
        border-bottom-color: #333;
    }
    
    .article-item:hover {
        background-color: #252525;
    }
    
    .article-title {
        color: #e0e0e0;
    }
    
    .article-desc {
        color: #aaa;
    }
    
    .article-meta {
        color: #888;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}